@extends("admin.base")
@section("contents")
    <div class="row mt-5">

        <div class="col-lg-4 mt-5 m-auto">
            <div class="card mb-3" style="border-radius: 10px">
                <div class="card-body w-100  " >
                    <h3 style="text-align: center" class="danger">添加电影语言类别页面</h3>
                    <form id="langform" method="post">
                        <div class="m-auto  col-10 ">
                            <div class="row">
                                <div class="col-10 m-auto">
                                    <div class="mb-3">

                                        <input class="form-control " type="hidden" name="id" value="{{isset($lang)?$lang->id:''}}">

                                        <label class="form-label" for="default-input">语言（汉）</label>
                                        <input class="form-control " type="text" name="language_ch" value="{{isset($lang)?$lang->language_ch:''}}">
                                    </div>
                                </div>
                            </div>
                            <div class="row">
                                <div class="col-10 m-auto">
                                    <div class="mb-3">
                                        <label class="form-label" for="default-input">تىل（维）</label>
                                        <input class="form-control" type="text" name="language_uy" value="{{isset($lang)?$lang->language_uy:''}}">
                                    </div>
                                </div>
                            </div>
                            <div class="row">
                                <div class="col-10 m-auto">
                                    <div class="mb-3">
                                        <label class="form-label" for="default-input">排序</label>
                                        <input class="form-control" type="text" name="order" value="{{isset($lang)?$lang->order:''}}">
                                    </div>
                                </div>
                            </div>
                        </div>
                    </form>
                    <div class="col-4 m-auto">
                        <button onclick="langsubmit()" class="btn btn-outline-info">提交</button>
                        &nbsp; &nbsp; &nbsp;
                        <button type="reset" class="btn btn-outline-danger">重置</button>
                    </div>
                </div>
            </div>
        </div>
    </div>
@endsection


@section("scripts")
    <script>
        function langsubmit() {
            var data = $("#langform").serialize()
            console.log(data),
            $.ajax({
                url: "langinsert",
                dataType: "json",
                data: data,
                async: true,
                type:"GET",
                headers:{'X-CSRF-TOKEN':'{{csrf_token()}}'},
                success: function (req) {
                    swal({
                        title: "操作成功",
                        text: req.title,
                        icon: "success",
                        button: "知道了",
                    })
                }
            })
        }
    </script>
@endsection

